package org.jaronsource.framework.tools.appgen;

import java.util.ArrayList;

import org.jaronsource.framework.tools.codegen.CodeGenConfiguation;
import org.jaronsource.framework.tools.codegen.GenericProcessor;
import org.jaronsource.framework.tools.codegen.IArtifact;
import org.jaronsource.framework.tools.codegen.IProcessor;
import org.jaronsource.framework.tools.codegen.JavaProcessor;
import org.jaronsource.framework.tools.codegen.SimpleGenericArtifact;
import org.jaronsource.framework.tools.codegen.SimpleJavaArtifact;

public class CommonAppGenConfiguation extends AppGenConfiguation {

	public CommonAppGenConfiguation() {
		this.codeGenConfig = new CodeGenConfiguation() {

			{
				setAllArticfacts( true );
				setBaseOutput( "baseOutput" );
				setArtifacts( new ArrayList<IArtifact>() {

					private static final long serialVersionUID = 8911319880298783876L;
					{
						add( new SimpleGenericArtifact( "jsp-list.ftl", "{baseOutput}/src/main/webapp/WEB-INF/views/{domainname}", "{domainname}_list.jsp" ) );
						add( new SimpleGenericArtifact( "jsp-show.ftl", "{baseOutput}/src/main/webapp/WEB-INF/views/{domainname}", "{domainname}_show.jsp" ) );
						add( new SimpleGenericArtifact( "jsp-edit.ftl", "{baseOutput}/src/main/webapp/WEB-INF/views/{domainname}", "{domainname}_edit.jsp" ) );
						add( new SimpleGenericArtifact( "xml-views.ftl", "{baseOutput}/src/main/webapp/WEB-INF/views/{domainname}", "views.xml" ) );
						add( new SimpleJavaArtifact( "java-domain.ftl", "{baseOutput}/src/main/java/{basePackage}/{relatedPackage}", "{domainName}.java", "domain" ) );
						add( new SimpleJavaArtifact( "java-controller.ftl", "{baseOutput}/src/main/java/{basePackage}/{relatedPackage}", "{domainName}Controller.java", "web.controller" ) );
					}
				} );

				setProcessors( new ArrayList<IProcessor>() {

					private static final long serialVersionUID = -2025378786169296820L;
					{
						add( new GenericProcessor() );
						add( new JavaProcessor() );
					}
				} );
			}
		};
	}
}
